package com.shadow.baiqun.delegate.receive.adapter;

import android.content.Context;

import com.shadow.baiqun.R;
import com.shadow.baiqun.config.ItemField;
import com.shadow.baiqun.config.ItemType;
import com.shadow.baiqun.delegate.receive.locationcheck.LocationCheckEntry;
import com.shadow.ui.recycler.MultipleItemEntity;
import com.shadow.ui.recycler.MultipleRecyclerAdapter;
import com.shadow.ui.recycler.MultipleViewHolder;

import java.util.List;

/**
 * @author zy
 * on 2018/5/29
 */
public class LocationAdapter extends MultipleRecyclerAdapter {

    public LocationAdapter(Context context, List<MultipleItemEntity> data) {
        super(data);
        addItemType(ItemType.ITEM_LOCATION_UNCHECK, R.layout.item_location_uncheck);
        addItemType(ItemType.ITEM_LOCATION_CHECKED, R.layout.item_location_checked);
    }

    @Override
    protected void convert(MultipleViewHolder helper, MultipleItemEntity item) {
        LocationCheckEntry checkEntry = item.getField(ItemField.ITEM_OBJ);
        switch (item.getItemType()) {
            case ItemType.ITEM_LOCATION_UNCHECK:
                break;
            case ItemType.ITEM_LOCATION_CHECKED:
                break;
            default:
                break;
        }
        helper.setText(R.id.tv_part_name, checkEntry.getPartcode());
        helper.setText(R.id.tv_count, String.valueOf(checkEntry.getStockNum()));
        helper.setText(R.id.tv_location, checkEntry.getDepotname());
    }
}
